package com.sdry.service.impl.cb;

import com.sdry.mapper.cb.StockMapper;
import com.sdry.model.lz.Materiel;
import com.sdry.model.zc.ZcInventoryInfoEntity;
import com.sdry.service.cb.StockService;
import com.sdry.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class StockServiceImpl implements StockService {
    @Autowired
    private StockMapper stockMapper;

    @Override
    public List<ZcInventoryInfoEntity> getStockList(Long customerId, String maNum) {
        if (StringUtil.isEmpty(maNum)){
            maNum = null;
        }
        if ("".equals(customerId)) {
            customerId = null;
        }
        return stockMapper.getStockList(customerId,maNum);
    }

    @Override
    public List<Materiel> getTiaoMaList(Integer page, Integer pageSize, String mid) {


        return stockMapper.getTiaoMaList((page - 1) * pageSize,pageSize,mid);
    }

    @Override
    public Integer getTiaoMaTotal(String mid) {
        return stockMapper.getTiaoMaTotal(mid);
    }
}
